import { Request, RequestForExportFile, SupplierRequest } from '@/plugins/supplier-request';
// 待考察供应商列表
export const queryToInspectSupplierService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/need-inspect/page',
  type: 'post',
  data,
  loadingFn
});

// 导出待考察供应商列表
export const exportToInspectSupplierService = (data, loadingFn) => SupplierRequest({
  url: '/supplier/export/need-inspect/export',
  type: 'post',
  data,
  loadingFn,
  isExport: true
});

// 待考察供应商转派
export const turnToSendService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/redeploy/inspectioner',
  type: 'post',
  data,
  loadingFn
});

// 待考察供应商转派记录
export const turnToSendRecordService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/query/inspectioner',
  type: 'post',
  data,
  loadingFn
});

// 获取人员信息
export const queryHrUserByNameService = (data, loadingFn) => SupplierRequest({
  url: '/component/query-user-like-name',
  type: 'get',
  data,
  loadingFn
});

// 未考察供应商列表
export const queryNotInspectSupplierService = (data) => {
  return Request('inspect/need-inspect-record/page', 'post', data)
}

// 导出未考察供应商列表
export const exportNotInspectSupplierService = (data) => {
  return RequestForExportFile('supplier/export/need-inspect-record/export', 'post', data)
}

// 考察报告列表
export const queryInspectReportService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/report/page',
  type: 'post',
  data,
  loadingFn
});
// 导出考察报告列表
export const exportInspectReportService = (data, loadingFn) => SupplierRequest({
  url: '/supplier/export/report/export',
  type: 'post',
  data,
  loadingFn,
  isExport: true
});
// 取消考察报告
export const cancelInspectReportService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/delete/report',
  type: 'post',
  data,
  loadingFn
});

// 考察计划管理
export const queryInspectPlanService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/plan/page',
  type: 'post',
  data,
  loadingFn
});

// 删除考察计划
export const deleteInspectPlanService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/delete/plan',
  type: 'get',
  data,
  loadingFn
});

// 取消考察计划
export const cancelInspectPlanService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/cancel/plan',
  type: 'post',
  data,
  loadingFn
});
// 导出考察计划
export const exportInspectPlanService = (data, loadingFn) => SupplierRequest({
  url: '/supplier/export/plan/export',
  type: 'post',
  data,
  loadingFn,
  isExport: true
});
// 新增考察计划
export const addPlanService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/plan/save',
  type: 'post',
  data,
  loadingFn
});
// 暂存考察计划
export const stashPlanService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/plan/stash',
  type: 'post',
  data,
  loadingFn
});
// 考察计划详情
export const queryPlanDetailService = (data, loadingFn) => SupplierRequest({
  url: `/inspect/plan/detail?id=${data.id}`,
  type: 'post',
  data,
  loadingFn
});
// 考察计划列表(通过供应商id查询 分页)
export const queryPlanDetailBySupplierId = (data) => {
  return Request(`inspect/plan/pageBySupplierId`, 'post', data)
}
// 录入考察报告
export const addReportService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/report/save',
  type: 'post',
  data,
  loadingFn
});
// 暂存考察报告
export const stashReportService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/report/stash',
  type: 'post',
  data,
  loadingFn
});
// 考察报告详情
export const queryReportDetailService = (data) => {
  return Request('inspect/report/detail', 'post', data)
}
// 考察报告详情原值现值对比
export const queryReportDiffValService = (data) => {
  return Request('inspect/report/diff', 'get', data)
}
// 供应商详情
export const querySupplierDetailService = (data) => {
  return Request('supplier/query-supplier-detail', 'get', data)
}

// 拜访记录查询
export const queryVisitRecordsService = (data) => {
  return Request('visit-record/pageVisitRecord', 'post', data)
}
// 拜访记录详情
export const queryRecordDetailService = (data) => {
  return Request('visit-record/getRecordById', 'get', data)
}
// 拜访记录新增
export const addRecordService = (data) => {
  return Request('visit-record/add', 'post', data)
}
// 拜访记录修改
export const editRecordService = (data) => {
  return Request('visit-record/edit', 'post', data)
}
// 分页查询来访记录待审批列表
export const queryVisitRecordBillsService = (data) => {
  return Request('visit-record/pageVisitRecord/bill', 'post', data)
}
// 根据主键id查询来访待审批记录
export const getRecordBillByIdService = (data) => {
  return Request('visit-record/getRecordById/bill', 'get', data)
}
// 暂存来访记录
export const stashVisitRecordService = (data) => {
  return Request('visit-record/temporary', 'post', data)
}
// 根据主键id删除来访记录
export const deleteRecordByIdService = (data) => {
  return Request('visit-record/deleteRecordById', 'get', data)
}
// 拜访记录导出
export const exportVisitRecordsService = (data) => {
  return RequestForExportFile('supplier/export/pageVisitRecord/export', 'get', data)
}
// 获取供应商信息
export const querySupplierInfoService = (data) => {
  return Request('component/supplier/query', 'post', data)
}
// 获取供应商信息-新建计划
export const queryPlanSupplierInfoService = (data) => {
  return Request('component/supplier/queryPlan', 'post', data)
}
// 获取来访人员信息
export const querySupplierPersonInfoService = (data, loadingFn) => SupplierRequest({
  url: '/component/supplier-person/all',
  type: 'post',
  data,
  loadingFn
});
// 获取管理区域
export const queryManageAreaService = (data) => {
  return Request('component/manage-area', 'get', data)
}
// 获取用户中心人员
export const queryHrUserService = (data) => {
  return Request('component/hr-user/query', 'post', data)
}
//  文件下载
export const downLoadFileService = (data) => {
  return RequestForExportFile('upload/getAttachment', 'get', data)
}

// 报告评价 - 获取报告评价详情
export const queryReportEvaluationService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/report/evaluation',
  type: 'post',
  data,
  loadingFn
});

// 报告评价 - 提交报告评价
export const submitReportEvaluationService = (data, loadingFn) => SupplierRequest({
  url: '/inspect/report/evaluation/submit',
  type: 'post',
  data,
  loadingFn
});
